package com.dylearn.utils;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//处理消息异常的类
@RestControllerAdvice
public class ProjectExceptionAdvice {

    @ExceptionHandler(Exception.class)
    public R doOtherException(Exception ex){
        //记录日志
        //发送消息给运维
        //发送邮件给开发人员，并将ex对象发送给开发人员

        //打印异常栈
        ex.printStackTrace();
        return new R("系统异常，请稍后再试！");
    }

}
